home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 193 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: clamage@Eng.sun.com (Steve Clamage)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: and, or, not
  5. Date: 30 Jan 1996 16:31:03 GMT
  6. Organization: Sun Microsystems Inc.
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4elgsk$ai1@engnews1.Eng.Sun.COM>
  9. References: <4ej3t4$7nb@jupiter.SJSU.EDU>
  10. Reply-To: clamage@Eng.sun.com
  11. NNTP-Posting-Host: taumet.eng.sun.com
  12. Content-Type: text
  13. X-Nntp-Posting-Host: taumet.eng.sun.com
  14. Content-Length: 1565
  15. X-Lines: 44
  16. Originator: clamage@taumet
  17.  
  18. In article 7nb@jupiter.SJSU.EDU, horstman@jupiter.SJSU.EDU (Cay S. Horstmann) writes:
  19. >I just got a press release from Borland that says their upcoming 5.0
  20. >compiler will support keywords and, or, not, that are synonyms to &&,
  21. >|| and !. 
  22.  
  23. >They say you can use those if your local keyboard makes it difficult
  24. >to write the traditional tokens. Hell, my local eyes make it difficult
  25. >to read them. Does that mean I can from now on just write
  26. >    if (0 <= x and x <= 1) . . .
  27. >and be in conformance with ANSI C++?
  28.  
  29. Yes.
  30.  
  31. >That is, are "and", "or", "not", now reserved words in ALL C++
  32. >programs, 
  33.  
  34. Yes. That is a difference from C, where they are macros in standard
  35. header file <iso646.h>.
  36.  
  37. Those are not the only new replacements for the funny symbols. Here is
  38. a complete list, from section 2.4 "Alternative tokens" in the draft:
  39.  
  40. Table 2 -- alternative tokens 
  41. altern.    primary     altern.    primary        altern. primary
  42. <%     {        and    &&        and_eq    &=
  43. %>    }        bitor    |        or_eq    |=
  44. <:     [        or    ||        xor_eq    ^=
  45. :>    ]        xor    ^        not    !
  46. %:    #        compl    ~        not_eq    !=
  47. %:%:    ##        bitand    &
  48.  
  49. The alternative tokens and corresponding primary tokens are functionally
  50. equivalent; you can use either form in an expression, and you need not
  51. be consistent. The corresponding forms behave differently only when
  52. "stringized".
  53.  
  54. The C++ Committee did not invent these, and asked for some of the more
  55. peculiar-looking items to be changed. But these are what was adopted
  56. by other ISO bodies, and it makes more sense to go along with them
  57. than to introduce incompatibilities.
  58. ---
  59. Steve Clamage, stephen.clamage@eng.sun.com
  60.  
  61.  
  62.  
  63. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  64.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  65.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  66.  
  67.